#include "asm.h"
#include "regdef.h"
#include "inst_test.h"

LEAF(n1_lu12i_w_test)
    
    addi.w    s0, s0 ,1
    addi.w    s2, zero, 0x0
    lu12i.w   t2, 0x1
###test inst
    addi.w    t1, zero, 0x0
    TEST_LU12I_W(0x00000, 0x00000)
    TEST_LU12I_W(0x00001, 0x00000)
    TEST_LU12I_W(0x00002, 0x00000)
    TEST_LU12I_W(0x00003, 0x00000)
    TEST_LU12I_W(0x00004, 0x00000)
    TEST_LU12I_W(0x00005, 0x00000)
    TEST_LU12I_W(0x00006, 0x00000)
    TEST_LU12I_W(0x00007, 0x00000)
    TEST_LU12I_W(0x00008, 0x00000)
    TEST_LU12I_W(0x00009, 0x00000)
    TEST_LU12I_W(0x0000a, 0x00000)
    TEST_LU12I_W(0x0000b, 0x00000)
    TEST_LU12I_W(0x0000c, 0x00000)
    TEST_LU12I_W(0x0000d, 0x00000)
    TEST_LU12I_W(0x0000e, 0x00000)
    TEST_LU12I_W(0x0000f, 0x00000)
    addi.w t1, zero, 0x0
    TEST_LU12I_W(0x11010, 0x11010)
    TEST_LU12I_W(0x11011, 0x11010)
    TEST_LU12I_W(0x11012, 0x11010)
    TEST_LU12I_W(0x11013, 0x11010)
    TEST_LU12I_W(0x11014, 0x11010)
    TEST_LU12I_W(0x11015, 0x11010)
    TEST_LU12I_W(0x11016, 0x11010)
    TEST_LU12I_W(0x11017, 0x11010)
    TEST_LU12I_W(0x11018, 0x11010)
    TEST_LU12I_W(0x11019, 0x11010)
    TEST_LU12I_W(0x1101a, 0x11010)
    TEST_LU12I_W(0x1101b, 0x11010)
    TEST_LU12I_W(0x1101c, 0x11010)
    TEST_LU12I_W(0x1101d, 0x11010)
    TEST_LU12I_W(0x1101e, 0x11010)
    TEST_LU12I_W(0x1101f, 0x11010)
    addi.w t1, zero, 0x0
    TEST_LU12I_W(0x22020, 0x22020)
    TEST_LU12I_W(0x22021, 0x22020)
    TEST_LU12I_W(0x22022, 0x22020)
    TEST_LU12I_W(0x22023, 0x22020)
    TEST_LU12I_W(0x22024, 0x22020)
    TEST_LU12I_W(0x22025, 0x22020)
    TEST_LU12I_W(0x22026, 0x22020)
    TEST_LU12I_W(0x22027, 0x22020)
    TEST_LU12I_W(0x22028, 0x22020)
    TEST_LU12I_W(0x22029, 0x22020)
    TEST_LU12I_W(0x2202a, 0x22020)
    TEST_LU12I_W(0x2202b, 0x22020)
    TEST_LU12I_W(0x2202c, 0x22020)
    TEST_LU12I_W(0x2202d, 0x22020)
    TEST_LU12I_W(0x2202e, 0x22020)
    TEST_LU12I_W(0x2202f, 0x22020)
    addi.w t1, zero, 0x0
    TEST_LU12I_W(0x33030, 0x33030)
    TEST_LU12I_W(0x33031, 0x33030)
    TEST_LU12I_W(0x33032, 0x33030)
    TEST_LU12I_W(0x33033, 0x33030)
    TEST_LU12I_W(0x33034, 0x33030)
    TEST_LU12I_W(0x33035, 0x33030)
    TEST_LU12I_W(0x33036, 0x33030)
    TEST_LU12I_W(0x33037, 0x33030)
    TEST_LU12I_W(0x33038, 0x33030)
    TEST_LU12I_W(0x33039, 0x33030)
    TEST_LU12I_W(0x3303a, 0x33030)
    TEST_LU12I_W(0x3303b, 0x33030)
    TEST_LU12I_W(0x3303c, 0x33030)
    TEST_LU12I_W(0x3303d, 0x33030)
    TEST_LU12I_W(0x3303e, 0x33030)
    TEST_LU12I_W(0x3303f, 0x33030)
    addi.w t1, zero, 0x0
    TEST_LU12I_W(0x44040, 0x44040)
    TEST_LU12I_W(0x44041, 0x44040)
    TEST_LU12I_W(0x44042, 0x44040)
    TEST_LU12I_W(0x44043, 0x44040)
    TEST_LU12I_W(0x44044, 0x44040)
    TEST_LU12I_W(0x44045, 0x44040)
    TEST_LU12I_W(0x44046, 0x44040)
    TEST_LU12I_W(0x44047, 0x44040)
    TEST_LU12I_W(0x44048, 0x44040)
    TEST_LU12I_W(0x44049, 0x44040)
    TEST_LU12I_W(0x4404a, 0x44040)
    TEST_LU12I_W(0x4404b, 0x44040)
    TEST_LU12I_W(0x4404c, 0x44040)
    TEST_LU12I_W(0x4404d, 0x44040)
    TEST_LU12I_W(0x4404e, 0x44040)
    TEST_LU12I_W(0x4404f, 0x44040)
    addi.w t1, zero, 0x0
    TEST_LU12I_W(0x55040, 0x55040)
    TEST_LU12I_W(0x55041, 0x55040)
    TEST_LU12I_W(0x55042, 0x55040)
    TEST_LU12I_W(0x55043, 0x55040)
    TEST_LU12I_W(0x55044, 0x55040)
    TEST_LU12I_W(0x55045, 0x55040)
    TEST_LU12I_W(0x55046, 0x55040)
    TEST_LU12I_W(0x55047, 0x55040)
    TEST_LU12I_W(0x55048, 0x55040)
    TEST_LU12I_W(0x55049, 0x55040)
    TEST_LU12I_W(0x5504a, 0x55040)
    TEST_LU12I_W(0x5504b, 0x55040)
    TEST_LU12I_W(0x5504c, 0x55040)
    TEST_LU12I_W(0x5504d, 0x55040)
    TEST_LU12I_W(0x5504e, 0x55040)
    TEST_LU12I_W(0x5504f, 0x55040)
    addi.w t1, zero, 0x0
    TEST_LU12I_W(0x66050, 0x66050)
    TEST_LU12I_W(0x66051, 0x66050)
    TEST_LU12I_W(0x66052, 0x66050)
    TEST_LU12I_W(0x66053, 0x66050)
    TEST_LU12I_W(0x66054, 0x66050)
    TEST_LU12I_W(0x66055, 0x66050)
    TEST_LU12I_W(0x66056, 0x66050)
    TEST_LU12I_W(0x66057, 0x66050)
    TEST_LU12I_W(0x66058, 0x66050)
    TEST_LU12I_W(0x66059, 0x66050)
    TEST_LU12I_W(0x6605a, 0x66050)
    TEST_LU12I_W(0x6605b, 0x66050)
    TEST_LU12I_W(0x6605c, 0x66050)
    TEST_LU12I_W(0x6605d, 0x66050)
    TEST_LU12I_W(0x6605e, 0x66050)
    TEST_LU12I_W(0x6605f, 0x66050)
    addi.w t1, zero, 0x0
    TEST_LU12I_W(0x88060, 0x88060)
    TEST_LU12I_W(0x88061, 0x88060)
    TEST_LU12I_W(0x88062, 0x88060)
    TEST_LU12I_W(0x88063, 0x88060)
    TEST_LU12I_W(0x88064, 0x88060)
    TEST_LU12I_W(0x88065, 0x88060)
    TEST_LU12I_W(0x88066, 0x88060)
    TEST_LU12I_W(0x88067, 0x88060)
    TEST_LU12I_W(0x88068, 0x88060)
    TEST_LU12I_W(0x88069, 0x88060)
    TEST_LU12I_W(0x8806a, 0x88060)
    TEST_LU12I_W(0x8806b, 0x88060)
    TEST_LU12I_W(0x8806c, 0x88060)
    TEST_LU12I_W(0x8806d, 0x88060)
    TEST_LU12I_W(0x8806e, 0x88060)
    TEST_LU12I_W(0x8806f, 0x88060)
    addi.w t1, zero, 0x0
    TEST_LU12I_W(0xaa070, 0xaa070)
    TEST_LU12I_W(0xaa071, 0xaa070)
    TEST_LU12I_W(0xaa072, 0xaa070)
    TEST_LU12I_W(0xaa073, 0xaa070)
    TEST_LU12I_W(0xaa074, 0xaa070)
    TEST_LU12I_W(0xaa075, 0xaa070)
    TEST_LU12I_W(0xaa076, 0xaa070)
    TEST_LU12I_W(0xaa077, 0xaa070)
    TEST_LU12I_W(0xaa078, 0xaa070)
    TEST_LU12I_W(0xaa079, 0xaa070)
    TEST_LU12I_W(0xaa07a, 0xaa070)
    TEST_LU12I_W(0xaa07b, 0xaa070)
    TEST_LU12I_W(0xaa07c, 0xaa070)
    TEST_LU12I_W(0xaa07d, 0xaa070)
    TEST_LU12I_W(0xaa07e, 0xaa070)
    TEST_LU12I_W(0xaa07f, 0xaa070)
    addi.w t1, zero, 0x0
    TEST_LU12I_W(0xcc080, 0xcc080)
    TEST_LU12I_W(0xcc081, 0xcc080)
    TEST_LU12I_W(0xcc082, 0xcc080)
    TEST_LU12I_W(0xcc083, 0xcc080)
    TEST_LU12I_W(0xcc084, 0xcc080)
    TEST_LU12I_W(0xcc085, 0xcc080)
    TEST_LU12I_W(0xcc086, 0xcc080)
    TEST_LU12I_W(0xcc087, 0xcc080)
    TEST_LU12I_W(0xcc088, 0xcc080)
    TEST_LU12I_W(0xcc089, 0xcc080)
    TEST_LU12I_W(0xcc08a, 0xcc080)
    TEST_LU12I_W(0xcc08b, 0xcc080)
    TEST_LU12I_W(0xcc08c, 0xcc080)
    TEST_LU12I_W(0xcc08d, 0xcc080)
    TEST_LU12I_W(0xcc08e, 0xcc080)
    TEST_LU12I_W(0xcc08f, 0xcc080)
    addi.w t1, zero, 0x0
    TEST_LU12I_W(0xee090, 0xee090)
    TEST_LU12I_W(0xee091, 0xee090)
    TEST_LU12I_W(0xee092, 0xee090)
    TEST_LU12I_W(0xee093, 0xee090)
    TEST_LU12I_W(0xee094, 0xee090)
    TEST_LU12I_W(0xee095, 0xee090)
    TEST_LU12I_W(0xee096, 0xee090)
    TEST_LU12I_W(0xee097, 0xee090)
    TEST_LU12I_W(0xee098, 0xee090)
    TEST_LU12I_W(0xee099, 0xee090)
    TEST_LU12I_W(0xee09a, 0xee090)
    TEST_LU12I_W(0xee09b, 0xee090)
    TEST_LU12I_W(0xee09c, 0xee090)
    TEST_LU12I_W(0xee09d, 0xee090)
    TEST_LU12I_W(0xee09e, 0xee090)
    TEST_LU12I_W(0xee09f, 0xee090)
    addi.w t1, zero, 0x0
    TEST_LU12I_W(0xff0a0, 0xff0a0)
    TEST_LU12I_W(0xff0a1, 0xff0a0)
    TEST_LU12I_W(0xff0a2, 0xff0a0)
    TEST_LU12I_W(0xff0a3, 0xff0a0)
    TEST_LU12I_W(0xff0a4, 0xff0a0)
    TEST_LU12I_W(0xff0a5, 0xff0a0)
    TEST_LU12I_W(0xff0a6, 0xff0a0)
    TEST_LU12I_W(0xff0a7, 0xff0a0)
    TEST_LU12I_W(0xff0a8, 0xff0a0)
    TEST_LU12I_W(0xff0a9, 0xff0a0)
    TEST_LU12I_W(0xff0aa, 0xff0a0)
    TEST_LU12I_W(0xff0ab, 0xff0a0)
    TEST_LU12I_W(0xff0ac, 0xff0a0)
    TEST_LU12I_W(0xff0ad, 0xff0a0)
    TEST_LU12I_W(0xff0ae, 0xff0a0)
    TEST_LU12I_W(0xff0af, 0xff0a0)
###detect exception
    bne s2, zero, inst_error
    nop
###score ++
    addi.w  s3, s3, 1
###output (s0<<24)|s3
inst_error:  
    slli.w  t1, s0, 24
    NOP4
    or      t0, t1, s3 
    NOP4
    st.w    t0, s1, 0
    jirl    zero, ra, 0
    nop
END(n1_lu12i_w_test)
